function changeColor(arg) {
	var myObj;
	var myObj1;

	if (arg == 1) {
		myObj = document.getElementById("color1");
		myObj.style.color = "red";
		myObj1 = document.getElementById("color2");
		myObj1.style.color = "#F8FBFC";
	} else {
		myObj = document.getElementById("color2");
		myObj.style.color = "red";
		myObj1 = document.getElementById("color1");
		myObj1.style.color = "#F8FBFC";
	}
}

//
function redirect(url) {
	window.location.replace(url);
}

function loadXMLDoc() {
	
}

// tegemisel veel
function displayResult() {
	var table = document.getElementsByTagName("table")[0];
	var rows = table.getElementsByTagName("tr");

	for ( var i = 0; i < rows.length; i++) {
		var cells = rows[i].getElementsByTagName("td");

		for ( var j = 0; j < cells.length; j++) {
			var cell = cells[j];
			cell.positionIndex = j;
			cell.rowIndex = i - 2;

			cell.onclick = function() {
				this.style.backgroundColor = "red";
				var xmlhttp;
				if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
					xmlhttp = new XMLHttpRequest();
				} else {// code for IE6, IE5
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}

				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						document.getElementById("proov").innerHTML = xmlhttp.responseText;
					}
				};
				xmlhttp.open("GET", "Test?x="+cell.positionIndex+"?y="+cell.rowIndex, true);
				xmlhttp.send();
			};
		}
	}
}